import random

class Card:
    def __init__(self, suit = 0, val = 1):
        self.suit = suit
        self.val = val
        

class Deck:
    def __init__(self, jokers = 0):
        self.num_jokers = jokers
        
        self.rebuild()
        self.shuffle()
        
    def rebuild(self):
        self.cards = []
        
        for suit in range(4):
            for num in range(1, 14):
                self.cards.append(Card(suit, num))
                
        for num in range(self.num_jokers):
            self.cards.append(Card(0, 0))
        
    def shuffle(self):
        random.shuffle(self.cards)
        
    def draw(self):
        return self.cards.pop(0)